package com.tlias.mapper;


import com.tlias.entity.Emp;
import com.tlias.entity.EmpExpr;
import com.tlias.entity.EmpQueryParam;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmpMapper {
//    @Select("select count(*) from emp")
//     Long count();
//    @Select("select e.*,d.name deptName  from emp e left join dept d on e.dept_id = d.id" )
    public List<Emp> page(EmpQueryParam param);
    @Options(useGeneratedKeys = true,keyColumn = "id",keyProperty = "id")//@Options告诉MyBatis，这个方法返回的id值，应该自动回填到emp对象中
//    @Insert("insert into emp values(null,#{username},#{password},#{name},#{gender},#{phone},#{job},#{salary},#{image},#{entryDate},#{deptId},#{createTime},#{updateTime})")
    void insertStaff(Emp emp);

    //批量删除员工
    void deleteStaff(List<Integer> ids);

    //查询员工第一种方法
    Emp getById(Integer id);

    //查询员工第二种方法
//    @Select("select * from emp where id = #{id}")
    Emp getId1(Integer id);
//    @Select("select * from emp_expr where emp_id = #{id}")
    List<EmpExpr> getId2(Integer id);

    //修改员工
    void update(Emp emp);

    //查询所有员工
    List<Emp> findAllList();

    //登录
    Emp selectUsernameAndPassword(Emp emp);
}
